<?php
namespace bee;

class request
{

  private static $values = array();

  public static function getValue($name, $defaultValue = null)
  {
    if(isset(static::$values[$name]))
    {
      return static::$values[$name];
    } else if(isset($_REQUEST[$name]))
    {
      static::$values[$name] = $_REQUEST[$name];
      return static::$values[$name];
    } else if(func_num_args() == 2)
    {
      return $defaultValue;
    }

    throw new \Exception("No value named $name in request.", 6969);
  }
}